import axios from 'axios';
// import Config from './config';
// import Base64 from '../../static/js/md5.js'

export default {

    /**
    * @param url
    * @param method
    * @param data
    * @returns {Promise}
    */
    request(url, method, data) {
        return new Promise((resolve, reject) => {
            // let Base64 = require('js-base64').Base64;
            axios({
                // url: Config.serverUrl + url,//请求路径
                url: '/index.php'+ url,
                method: method,//请求模式
                data: data || {},//请求参数
                headers: { //sessionStorage.che_token
                    'Content-Type': 'application/json'
                    // Authorization: "Bearer " + Base64.decode(sessionStorage.che_token), //token
                }
            }).then(res => {//成功回调
                resolve(res);
            }).catch(err => {//异常回调
                reject(err);
            })
        })
    },

}